UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8weFVvj/XeBaBYJLeV7i4VzQMC04zzZ9xRtlHJhGpeg=' 
WHERE 
  key_id = '4c2b4b2b4121ead41d7adcda961773464c99dea684c2ece21a7466cb913afa53' 
  AND (
    token = '8weFVvj/XeBaBYJLeV7i4VzQMC04zzZ9xRtlHJhGpeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046