UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mmKQptz+kccX2uJtObHGspD/6OjEuP9n/8z4Q7k0wNU=' 
WHERE 
  key_id = '309aa45964d3c36105e7c709784b0d9f261e46b2894c62e14c409a0180e04696' 
  AND (
    token = 'mmKQptz+kccX2uJtObHGspD/6OjEuP9n/8z4Q7k0wNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040