UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lHUh4WMx1UurA1ztI0hFiYgQ6WTB0wNceBK8T17pXGM=' 
WHERE 
  key_id = '416b2e32523be4adff0df8bd3ed6e47a33c3554eb40eba020b87793b5d2364c6' 
  AND (
    token = 'lHUh4WMx1UurA1ztI0hFiYgQ6WTB0wNceBK8T17pXGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043