UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ApMvOdz0vc+2I9VfuBl7A5SmrW0yq3EDdbqRZSuBe/0=' 
WHERE 
  key_id = 'bbd48849cc28e9fd31823799c937898d44615e0155205f37de1d4b3e9118973c' 
  AND (
    token = 'ApMvOdz0vc+2I9VfuBl7A5SmrW0yq3EDdbqRZSuBe/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041