UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xEfj70numZXt03AKfdiuh+2EI7fRhkfRGxc/U5RN9kM=' 
WHERE 
  key_id = '173acf5ef807518e57b2328f0a6384a7a4b2a3f880f046596402f0dcdfc03b9e' 
  AND (
    token = 'xEfj70numZXt03AKfdiuh+2EI7fRhkfRGxc/U5RN9kM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028