UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9NFgNWtxsV9l4btr2kVt5QKqW9BJkR2J6HgCkAe7NH8=' 
WHERE 
  key_id = '303d0d19ada4005f49db6685d82945ec3366eaf642fc9bac0a3cebd26c955216' 
  AND (
    token = '9NFgNWtxsV9l4btr2kVt5QKqW9BJkR2J6HgCkAe7NH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040