UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H45C2BEM7YDQxkz0z2IT0HFjdrN/ky+8JxiiW+NBDWg=' 
WHERE 
  key_id = '02438dfc5ef6302b4cb3c02b728c3b2aa59e74353efaa004eda434e5e368d52a' 
  AND (
    token = 'H45C2BEM7YDQxkz0z2IT0HFjdrN/ky+8JxiiW+NBDWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031