UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkx6n6l3msseKGSo9/mz8noQyLCieper7SPJNV4lc/k=' 
WHERE 
  key_id = '5152e432283d063b8eef42b0f1d27c213275d56cd618238c25d1f126e9d3eac3' 
  AND (
    token = 'gkx6n6l3msseKGSo9/mz8noQyLCieper7SPJNV4lc/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016