UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YyX+JE1KJ6v5qXc2h7+QcK+hl3nT8ILY8s0F1lRUrd4=' 
WHERE 
  key_id = '6103dd22f0f629127544be9a5454baf698050a6d47e013f7028f3e61b770e1f6' 
  AND (
    token = 'YyX+JE1KJ6v5qXc2h7+QcK+hl3nT8ILY8s0F1lRUrd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031