UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YMjqQd3mh2dJmO971HGd8uEam1P4P0eSz1krF4/gvg8=' 
WHERE 
  key_id = 'abbb349a2fd409da1b37cc31282e66b72499cdfc7f189b1cab55423cb0f1616c' 
  AND (
    token = 'YMjqQd3mh2dJmO971HGd8uEam1P4P0eSz1krF4/gvg8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031