UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NsPsvPn5OmTC4Lm0ELrs6nB3QEnd5bkegUso1MD6hac=' 
WHERE 
  key_id = 'e297c218f5b7d14091b8351674ab5263c4156d7acfa64eac3da43fe5be441963' 
  AND (
    token = 'NsPsvPn5OmTC4Lm0ELrs6nB3QEnd5bkegUso1MD6hac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025