UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gH1QI0cPMFiKJm5PzWlkai4L/42oYEa6T2i/Llq+sSM=' 
WHERE 
  key_id = '829b6a588cbaeea2fa582c2d187d208604200c81506cc160e230da57efe41589' 
  AND (
    token = 'gH1QI0cPMFiKJm5PzWlkai4L/42oYEa6T2i/Llq+sSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025