UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eRi/4OPsfaOAlToLxDYGx2e+DPCo7jdCUlHBiVSHWzk=' 
WHERE 
  key_id = 'd07407f53295c331404c5de8783550759d222b410f23b86ce6ddc1fcedc8e05d' 
  AND (
    token = 'eRi/4OPsfaOAlToLxDYGx2e+DPCo7jdCUlHBiVSHWzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041