UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8QkJuWT2Sg057j9e4YaU2KAXua78MCSTtxX2UTsNF7M=' 
WHERE 
  key_id = '458dc51522cc1776485489ec42eb560bb7fa0e24962443b3ee91fbe1726686c0' 
  AND (
    token = '8QkJuWT2Sg057j9e4YaU2KAXua78MCSTtxX2UTsNF7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045