UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IIGp8EdoZuZR0odloxfZSGB2k5AzHdCA+PQDtA62DQ8=' 
WHERE 
  key_id = '6965ded3a7175492d4c099e38a691e71bdc2da5926271ddd9705a8511e837272' 
  AND (
    token = 'IIGp8EdoZuZR0odloxfZSGB2k5AzHdCA+PQDtA62DQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030