UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NwaUx8+3ZsFhfWhxIeRM0X1JyXOt7YTuenthfdkHEAA=' 
WHERE 
  key_id = 'de5cc9b97deb504d2a20351ab155299c0687e2558de0b45e6be52b1a53df8fef' 
  AND (
    token = 'NwaUx8+3ZsFhfWhxIeRM0X1JyXOt7YTuenthfdkHEAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027