UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LpIb7Kp44XNozjlGKQprFw3sjWfnA0mq7D5BnVMjwNs=' 
WHERE 
  key_id = 'be63036802a5d1b66a2c733cf21057f4a10f2c3e6cb9642b8918f7d86667feec' 
  AND (
    token = 'LpIb7Kp44XNozjlGKQprFw3sjWfnA0mq7D5BnVMjwNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044