UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8ngM0ff8/XO3t1k/s/6e9JBxy4PwrvLOa4KOrH4xPtE=' 
WHERE 
  key_id = '658d315487770105626388bb6fb512524043bb3e83405019a067cf35297d9951' 
  AND (
    token = '8ngM0ff8/XO3t1k/s/6e9JBxy4PwrvLOa4KOrH4xPtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027