UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AGDRQCmqu/n4s05BTaL37FEY99FOdsfQrJNFbWQZ3pQ=' 
WHERE 
  key_id = '3e219e4adf1e807aee5d0e8d444c1893774b1c9202bc6ab1a96e8681099478f1' 
  AND (
    token = 'AGDRQCmqu/n4s05BTaL37FEY99FOdsfQrJNFbWQZ3pQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042