UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9JFepdJ2DH3Nh30d6PaB2i/zOwZ6hQJ8JvkR7IHh36Y=' 
WHERE 
  key_id = '1ba3679ca44b0572b8029cc315a2f31d06f906f07623fab5909b7eb36850469d' 
  AND (
    token = '9JFepdJ2DH3Nh30d6PaB2i/zOwZ6hQJ8JvkR7IHh36Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017