UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ANbtBYl5UUH4DeEqvDGrKQbhndYEcp7P0UYJWDbJYD0=' 
WHERE 
  key_id = '525e237e21c23b4790e9f0502f4ab8a9f7e2b96042c8a15036e0b8f4107eba3d' 
  AND (
    token = 'ANbtBYl5UUH4DeEqvDGrKQbhndYEcp7P0UYJWDbJYD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035