UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yF4yn4/QrUziq35eRgDq2+lxWIW00a3KxoWy7oRv9A8=' 
WHERE 
  key_id = 'dddc159196392ed7251ecde04bf4a39056bf0ccf7c5e6d1ab589dbd87f37b7ab' 
  AND (
    token = 'yF4yn4/QrUziq35eRgDq2+lxWIW00a3KxoWy7oRv9A8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046