UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+URbNeuAn2hOl+MaODNrc6tQ7aFUffhRKWow84yEhoM=' 
WHERE 
  key_id = 'aa9f525c14324e5e43e97272662feed763e3c819bda2634f1402d25afc90e7a4' 
  AND (
    token = '+URbNeuAn2hOl+MaODNrc6tQ7aFUffhRKWow84yEhoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034