UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IvAPcaUfPDLVzLzHz45AYOKMV2nNe4W/tQB1D7S2xKs=' 
WHERE 
  key_id = 'd992a520e08b44aec61602e2c4c9a4406d7132c20a474b8aeefc774532b4b725' 
  AND (
    token = 'IvAPcaUfPDLVzLzHz45AYOKMV2nNe4W/tQB1D7S2xKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032