UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z5ur96LFhg+5uH2x5712QvCIv9miza5X0XM+3lU7fJw=' 
WHERE 
  key_id = '45baeae1c168b1c896e860e1ea17893b98ada1bac23b640bd4ffb346d7428f94' 
  AND (
    token = 'z5ur96LFhg+5uH2x5712QvCIv9miza5X0XM+3lU7fJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034