UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JtHrONGg5wtNHrvQbfY9EQPGDcmY+5NJzlAdP7VkyUk=' 
WHERE 
  key_id = 'e98797017d9f8c01333631682eba647d3588048b4f9b17c14e13794b28d40bc5' 
  AND (
    token = 'JtHrONGg5wtNHrvQbfY9EQPGDcmY+5NJzlAdP7VkyUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036