UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bjihp3zpDHuki4kZARdOHoEFQEJdxugkie0slpbiDcg=' 
WHERE 
  key_id = 'ce6460b9b1b4deb271cf50df4b01cba909341978675e5ffce5f0dcb98a0793e3' 
  AND (
    token = 'Bjihp3zpDHuki4kZARdOHoEFQEJdxugkie0slpbiDcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021