UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bt2gGeR8WcfS4u8byAhVytsNi8B07GdTyS8zn8zaqCk=' 
WHERE 
  key_id = '986e4f4f8877dc75cda957411181f5ced6422dd3079a81973c9b545bec5eb8b0' 
  AND (
    token = 'bt2gGeR8WcfS4u8byAhVytsNi8B07GdTyS8zn8zaqCk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046