UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BOz/qRwrA2SbhSlUUsAHfiDiSeDJq6tXdlypSKDPUrI=' 
WHERE 
  key_id = '2452fbb58870f0fce03382491426b9d320082deceaca20de9c54f17f533c4344' 
  AND (
    token = 'BOz/qRwrA2SbhSlUUsAHfiDiSeDJq6tXdlypSKDPUrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047