UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Np2qik8JDHDOiAMYY/Ovg7gl/U2UZpsozOESbykmksM=' 
WHERE 
  key_id = '09d47f287f0526b797a9449fe3ca7eae620551b06fb69590aad3ac064d19e04a' 
  AND (
    token = 'Np2qik8JDHDOiAMYY/Ovg7gl/U2UZpsozOESbykmksM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038