UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zoWxPnwQSSH6g/Yh7STmtyeP7tjOapz8luzmC6OfbIk=' 
WHERE 
  key_id = '9d46e938a337bd19d0152f39711c67be90f74dd727e117f093973bc2baf9d1b8' 
  AND (
    token = 'zoWxPnwQSSH6g/Yh7STmtyeP7tjOapz8luzmC6OfbIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022