UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OWZy7Lrj6EwFLPW4KUSkEIHr3P2dIlUfRxIKHffp1xQ=' 
WHERE 
  key_id = '0ba1e864e333bb14631faec2e01b17c0402dd3d98f3cb4da7d8094ba5372c88a' 
  AND (
    token = 'OWZy7Lrj6EwFLPW4KUSkEIHr3P2dIlUfRxIKHffp1xQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046