UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n18ZVMKU++YSE+I1o640aMq5zFRdHUA5OFSpHnviuH8=' 
WHERE 
  key_id = '0db78214c0263cf06465574940ac046be962a78c4ae7ec8911322d894dd017c3' 
  AND (
    token = 'n18ZVMKU++YSE+I1o640aMq5zFRdHUA5OFSpHnviuH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028