UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nq46/rf7k8NvyviVTs6d4qOh8fJQhVpuhaWef999QQA=' 
WHERE 
  key_id = 'b1d64f578a711e27afc42769856acd408a8a8166d69d153276eba5f455bc95ed' 
  AND (
    token = 'nq46/rf7k8NvyviVTs6d4qOh8fJQhVpuhaWef999QQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031