UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qn9i64zPv5Dmn6CZqW7IZ3/zaVFpRTS2kF+J+nRU35c=' 
WHERE 
  key_id = '85bb19a02095a145317b82132448080478af7678ea3ea0321da7d0ad9698039b' 
  AND (
    token = 'Qn9i64zPv5Dmn6CZqW7IZ3/zaVFpRTS2kF+J+nRU35c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042