UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C7kdWYOxeDe5vbHz+geJR2NAJCnKJb9+2sY+cP+gQEo=' 
WHERE 
  key_id = '12a74b355dc56d14d25e0072945143b7cae86d8aceea9cb70e5347fe04f05007' 
  AND (
    token = 'C7kdWYOxeDe5vbHz+geJR2NAJCnKJb9+2sY+cP+gQEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035