UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7VA81Sleuha1EuuoU8W5oqvucPLHRttckuveIsITMAo=' 
WHERE 
  key_id = '2fb7002aa23e45c6215517b8be4755492ffe253f2c4a5c385c1ad7d07ad2621e' 
  AND (
    token = '7VA81Sleuha1EuuoU8W5oqvucPLHRttckuveIsITMAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040