UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rJk0HNu7avn0HfxUhkhrhaSAYmy1xRWKt3BvGYsz47Y=' 
WHERE 
  key_id = '41c444a645057897f72f595e3466106c0cd03100a86855c624299330238f1595' 
  AND (
    token = 'rJk0HNu7avn0HfxUhkhrhaSAYmy1xRWKt3BvGYsz47Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034