UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L1ePQ4WCD47SNnU3QU5pBBuq+QetDhKmozFhN375vVU=' 
WHERE 
  key_id = 'b74f0ac2951c6eccc0731f91e5897d73e92ac073794d5a16e3f6435ecd9e1ad6' 
  AND (
    token = 'L1ePQ4WCD47SNnU3QU5pBBuq+QetDhKmozFhN375vVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030