UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '51xpRih4wiyv2Wq4S5VTYI02Ojg4PyZPM1om1W7sl1g=' 
WHERE 
  key_id = '2af6cfc9a88bfbba796255282c174fef242078b0a9dc5c566f400020d0996e54' 
  AND (
    token = '51xpRih4wiyv2Wq4S5VTYI02Ojg4PyZPM1om1W7sl1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024