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

Query time 0.00032